package com.quanyue.haircut.shop.service.impl;

import com.quanyue.haircut.domain.entity.SystemNotice;
import com.quanyue.haircut.shop.mapper.NoticeMapper;
import com.quanyue.haircut.shop.service.NoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class NoticeServiceImpl implements NoticeService {
    @Autowired
    private NoticeMapper noticeMapper;

    @Override
    public void addNotice(SystemNotice content) {
        content.setCreateTime(LocalDateTime.now());
        noticeMapper.insert(content);
    }

    @Override
    public void deleteNotice(Integer noticeId) {
        noticeMapper.deleteOne(noticeId);
    }

    @Override
    public List <SystemNotice> findNotice(Integer merchantNo) {
        return noticeMapper.findByMerchantNo(merchantNo);
    }
}
